home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Storage / ODCtr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  6.4 KB  |  207 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ODCtr.cpp
  3.  
  4.     Contains:    Implementation of ODCtr
  5.  
  6.     Owned by:    Vincent Lo
  7.  
  8.     Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>      6/6/96    jpa        T10020: Fixed uninitialized-IText variable
  13.                                     warnings.
  14.          <6>     10/8/95    TJ        Fixes Recomended by Refball
  15.          <5>      8/3/95    RR        #1257260: Collapse B classes. Remove
  16.                                     somInit methods. Don't call IsInitialized
  17.                                     or SubclassResponsibility
  18.          <4>     5/26/95    VL        1251403: Multithreading naming support.
  19.          <3>     9/23/94    VL        1184166: ContainerName is ODIText now.
  20.                                     1184272: ContainerID is now a sequence of
  21.                                     octets.
  22.          <2>      7/7/94    VL        Added SubClassResponsibility.
  23.          <1>     6/28/94    VL        first checked in
  24.  
  25.     To Do:
  26.     In Progress:
  27.         
  28. */
  29.  
  30. #define ODContainer_Class_Source
  31. #include <ODCtr.xih>
  32.  
  33. #ifndef _ITEXT_
  34. #include <IText.h>
  35. #endif
  36.  
  37. #ifndef _BARRAY_
  38. #include <BArray.h>
  39. #endif
  40.  
  41. SOM_Scope ODStorageSystem*  SOMLINK ODContainerGetStorageSystem(ODContainer *somSelf, Environment *ev)
  42. {
  43.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  44.     ODContainerMethodDebug("ODContainer","ODContainerGetStorageSystem");
  45.  
  46.     WARN("A subclass should have overridden this method!");
  47.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  48.     return kODNULL;
  49. }
  50.  
  51. SOM_Scope ODContainerID  SOMLINK ODContainerGetID(ODContainer *somSelf, Environment *ev)
  52. {
  53.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  54.     ODContainerMethodDebug("ODContainer","ODContainerGetID");
  55.  
  56.     WARN("A subclass should have overridden this method!");
  57.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  58.     
  59.     // The following lines are used to pacify the compiler.
  60.     // They should never be executed.
  61.     ODByteArray    ba = {0,0,kODNULL};
  62.     return ba;
  63. }
  64.  
  65. SOM_Scope ODContainerName  SOMLINK ODContainerGetName(ODContainer *somSelf, Environment *ev)
  66. {
  67.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  68.     ODContainerMethodDebug("ODContainer","ODContainerGetName");
  69.  
  70.     WARN("A subclass should have overridden this method!");
  71.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  72.  
  73.     // The following lines are used to pacify the compiler.
  74.     // They should never be executed.
  75.     ODContainerName    name;
  76.     InitIText(&name);
  77.     return name;
  78. }
  79.  
  80. SOM_Scope void  SOMLINK ODContainerSetName(ODContainer *somSelf, Environment *ev,
  81.         ODContainerName* name)
  82. {
  83.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  84.     ODContainerMethodDebug("ODContainer","ODContainerSetName");
  85.  
  86.     WARN("A subclass should have overridden this method!");
  87.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  88. }
  89.  
  90. /*
  91.  *  private by convention
  92.  */
  93.  
  94. SOM_Scope ODDocument*  SOMLINK ODContainerAcquireDocument(ODContainer *somSelf, Environment *ev,
  95.         ODDocumentID id)
  96. {
  97.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  98.     ODContainerMethodDebug("ODContainer","ODContainerAcquireDocument");
  99.  
  100.     WARN("A subclass should have overridden this method!");
  101.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  102.     return kODNULL;
  103. }
  104.  
  105. SOM_Scope void  SOMLINK ODContainerInitContainer(ODContainer *somSelf, Environment *ev,
  106.         ODStorageSystem* system,
  107.         ODContainerID* id)
  108. {
  109.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  110.     ODContainerMethodDebug("ODContainer","ODContainerInitContainer");
  111.  
  112.     SOM_TRY
  113.     somSelf->InitRefCntObject(ev);
  114.     SOM_CATCH_ALL
  115.     SOM_ENDTRY
  116. }
  117.  
  118. SOM_Scope ODContainer*  SOMLINK ODContainerCreate(ODContainer *somSelf, Environment *ev)
  119. {
  120.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  121.     ODContainerMethodDebug("ODContainer","ODContainerCreate");
  122.  
  123.     WARN("A subclass should have overridden this method!");
  124.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  125.  
  126.     return somSelf;
  127. }
  128.  
  129. SOM_Scope ODContainer*  SOMLINK ODContainerOpen(ODContainer *somSelf, Environment *ev)
  130. {
  131.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  132.     ODContainerMethodDebug("ODContainer","ODContainerOpen");
  133.  
  134.     WARN("A subclass should have overridden this method!");
  135.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  136.     return somSelf;
  137. }
  138.  
  139. SOM_Scope ODContainer*  SOMLINK ODContainerClose(ODContainer *somSelf, Environment *ev)
  140. {
  141.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  142.     ODContainerMethodDebug("ODContainer","ODContainerClose");
  143.  
  144.     WARN("A subclass should have overridden this method!");
  145.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  146.     return somSelf;
  147. }
  148.  
  149. SOM_Scope ODContainer*  SOMLINK ODContainerReleaseDocument(ODContainer *somSelf, Environment *ev,
  150.         ODDocument* document)
  151. {
  152.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  153.     ODContainerMethodDebug("ODContainer","ODContainerReleaseDocument");
  154.  
  155.     WARN("A subclass should have overridden this method!");
  156.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  157.     return somSelf;
  158. }
  159.  
  160. SOM_Scope void  SOMLINK ODContainersomUninit(ODContainer *somSelf)
  161. {
  162.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  163.     ODContainerMethodDebug("ODContainer","ODContainersomUninit");
  164.  
  165.     ODContainer_parent_ODRefCntObject_somUninit(somSelf);
  166. }
  167.  
  168. SOM_Scope void  SOMLINK ODContainerAcquire(ODContainer *somSelf, Environment *ev)
  169. {
  170.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  171.     ODContainerMethodDebug("ODContainer","ODContainerAcquire");
  172.  
  173.     ODContainer_parent_ODRefCntObject_Acquire(somSelf,ev);
  174. }
  175.  
  176. SOM_Scope void  SOMLINK ODContainerRelease(ODContainer *somSelf, Environment *ev)
  177. {
  178.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  179.     ODContainerMethodDebug("ODContainer","ODContainerRelease");
  180.  
  181.     ODContainer_parent_ODRefCntObject_Release(somSelf,ev);
  182. }
  183.  
  184. SOM_Scope ODSize  SOMLINK ODContainerPurge(ODContainer *somSelf, Environment *ev,
  185.         ODSize size)
  186. {
  187.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  188.     ODContainerMethodDebug("ODContainer","ODContainerPurge");
  189.  
  190.     // dh - Wrapped purge call in a SOM_TRY block.
  191.  
  192.     ODSize    purgeSize = 0; ODVolatile( purgeSize );
  193.     
  194.     SOM_TRY
  195.  
  196.         purgeSize = (ODContainer_parent_ODRefCntObject_Purge(somSelf,ev,size));;
  197.  
  198.     SOM_CATCH_ALL
  199.         WARN("Error %ld trying to purge in ODNameSpaceManagerPurge",ErrorCode());
  200.         SetErrorCode(kODNoError);        // dh - Eat the exception; Purge should not 
  201.                                         // propagate it because clients function
  202.                                         // fine whether memory was purged or not.
  203.     SOM_ENDTRY
  204.  
  205.     return purgeSize;
  206. }
  207.